<template>
  <div class="component-teamCount">
    <div class="component-mainHeader">
      <div class="top">
        <div class="topleft">
          <p>
            <span class="iconfont" style="color:#1abc9a;margin-right:3px;">&#xe607;</span>采购管理
          </p>
        </div>
        <div class="topright">
          <el-button type="info" @click="$router.go(0)">
            <span style="font-weight:700;margin-right:5px;" class="iconfont">&#xe662;</span>刷新
          </el-button>
        </div>
      </div>
    </div>
    <div class="component-searchHeader">
      <div class="search-header">
        <div class="left-title">
          <p class="left-text">
            <span class="iconfont" style="font-weight:700">&#xe63d;</span>筛选查询
          </p>
          <div class="right">
            <button @click="findRes">查询</button>
          </div>
        </div>
      </div>
    </div>

    <div class="component-search-box">
      <el-form :inline="true" :model="teamSearch" class="demo-form-inline">
        <el-form-item label="采购单号：" style="width:325px;">
          <el-input clearable v-model="teamSearch.name" placeholder="请输入采购单号"></el-input>
        </el-form-item>
        <el-form-item label="采购日期：" style="width:325px;">
          <el-date-picker
            v-model="teamSearch.value1"
            type="date"
            placeholder="选择日期"
            format="yyyy 年 MM 月 dd 日"
            default-time="00:00:00"
            value-format="timestamp">
          </el-date-picker>
        </el-form-item>
       <!-- <el-form-item label="采购项目：" style="width:320px;margin-left: 10px;">
          <el-select clearable v-model="teamSearch.pro" clearable placeholder="请选择报销类型">
            <el-option label="出差" value="0"></el-option>
            <el-option label="日常" value="1"></el-option>
          </el-select>
        </el-form-item>-->
      </el-form>
    </div>

    <div class="component-listHeader">
      <div class="search-header">
        <div class="left-title">
          <p class="left-text">
            <span class="iconfont">&#xe61e;</span>
            采购列表
          </p>
          <div class="right"></div>
        </div>
      </div>
    </div>

    <div class="table">
      <el-table
        ref="multipleTable"
        :data="teamInfo"
        tooltip-effect="dark"
        style="width: 1100px;margin:0 auto"
        border
      >
        <el-table-column label="序号" align="center" type="index"></el-table-column>
        <el-table-column label="采购单号" align="center" prop="buyNo"></el-table-column>
        <el-table-column label="采购时间" align="center">
          <template slot-scope="scope">
            {{scope.row.buyDate | dateFilter}}
          </template>
        </el-table-column>
        <el-table-column label="入库时间" align="center">
          <template slot-scope="scope">
            {{scope.row.inDate | dateFilter}}
          </template>
        </el-table-column>
        <el-table-column label="采购负责人" align="center" prop="responseUser"></el-table-column>
        <el-table-column label="采购金额(￥)" align="center" prop="buyMoney"></el-table-column>
        <el-table-column label="操作" align="center" width="160">
          <template slot-scope="scope">
            <a @click="handleDetail(scope.row.inId)" type="text" size="small" class="red">查看详情</a>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- 分页 -->
    <div class="component-paging" v-if="teamInfo.length > 0">
      <div class="table-bottom">
        <div class="bottom-left" style="margin-left: 42px;">
        </div>
        <div class="paging">
          <div class="paging-left">
            <p>
              共
              <span>{{Math.ceil(total/pageSize)}}</span> 页/
              <span>{{total}}</span> 条数据
            </p>
          </div>
          <el-pagination
            background
            @size-change="SizeChange($event,dataInit,currentPage,pageSize)"
            @current-change="CurrentChange($event,dataInit,currentPage,pageSize)"
            :current-page="currentPage"
            :page-sizes="[10, 20, 30]"
            :page-size="pageSize"
            layout="sizes, prev, pager, next, jumper"
            :total="total"
          ></el-pagination>
        </div>
      </div>
    </div>


  </div>
</template>

<script>
  export default {
    data(){
      return {
        teamSearch: {
          name: "",
          value1:'',
          pro: "",
        },
        teamList:[],//施工队队长列表
        teamInfo:[],//查询信息列表
        // 数据总条数
        total: 10,
        // 每页显示数据的条数
        pageSize: 10,
        // 当前显示的页面页码
        currentPage: 1,
      };
    },
    mounted(){
      this.dataInit();
    },
    methods:{
       //列表查询
      dataInit(){
        let that = this;
        let suCb = function(res){
          that.total = res.data.rowCount;
          that.teamInfo = res.data.data;
          console.log(res.data)
        }
        let erCb = function(res){
          console.log(res)
        }
        let postData = {
          buyNo:that.teamSearch.name,//采购单号
          buyDate:that.teamSearch.value1+'',//采购日期
          pageSize:that.pageSize.toString(),
          pageCurrent:that.currentPage.toString()
        }
        let palyParam = {
          url: "/api/web/PurchaseManagement/selectBuyInStore",
          methods:'post',
          data: postData,
          success: suCb,
          error: erCb,
        }
        that.$https(palyParam)
      },
      //查看详情
      handleDetail(val){
          this.$router.push({name:'procurementList',params:{id:val,flag:1}})
      },
      findRes(){
        this.currentPage = 1;
        this.dataInit()
      }
    }
  }
</script>

<style scoped>
  .component-searchHeader .search-header {
    width: 1100px;
    box-sizing: border-box;
    border: 1px solid rgba(228, 228, 228, 1);
    background-color: rgba(255, 255, 255, 1);
    margin: 20px auto 0;
  }

  .component-searchHeader .search-header .left-title {
    display: flex;
    justify-content: space-between;
    width: 100%;
    background-color: rgba(243, 243, 243, 1);
    height: 45px;
    box-sizing: border-box;
  }

  .component-searchHeader .search-header .left-title .left-text {
    width: 20%;
    color: #666;
    line-height: 45px;
    font-family: "微软雅黑";
    font-weight: 400;
    font-size: 12px;
    text-align: left;
    margin: 0 0 0 30px;
  }

  .component-searchHeader .right {
    width: 70%;
    display: flex;
    justify-content: flex-end;
    margin-right: 30px;
  }

  .component-searchHeader .right button {
    padding: 0 25px;
    height: 30px;
    margin: 8px 5px;
    line-height: 30px;
    font-size: 14px;
    color: #666;
    background-color: #fff;
    border: 1px solid #ccc;
  }

  .component-searchHeader .right button:hover {
    background-color: #f3f3f3;
    cursor: pointer;
  }
  .component-search-box {
    width: 1100px;
    box-sizing: border-box;
    background-color: #fff;
    border: 1px solid #e4e4e4;
    border-top: none;
    margin: 0 auto;
    text-align: left;
    padding-left: 30px;
    line-height: 60px;
    padding-bottom: 15px;
    padding-top: 15px;
  }
  .component-search-box .el-input__inner {
    height: 35px;
    display: inline-block;
  }
  .el-form-item {
    margin-bottom: 0;
  }
  .component-listHeader .search-header {
    width: 1100px;
    box-sizing: border-box;
    border: 1px solid rgba(228, 228, 228, 1);
    border-bottom: none;
    background-color: rgba(255, 255, 255, 1);
    margin: 20px auto 0;
  }

  .component-listHeader .search-header .left-title {
    display: flex;
    justify-content: space-between;
    width: 100%;
    background-color: rgba(243, 243, 243, 1);
    height: 45px;
    box-sizing: border-box;
  }

  .component-listHeader .search-header .left-title .left-text {
    width: 20%;
    color: #666;
    line-height: 45px;
    font-family: "微软雅黑";
    font-weight: 400;
    font-size: 12px;
    text-align: left;
    margin: 0 0 0 30px;
  }

  .component-listHeader .search-header .right {
    width: 70%;
    display: flex;
    justify-content: flex-end;
    margin-right: 10px;
  }

  .component-listHeader .search-header .right button{
    padding: 0 15px;
    height: 30px;
    width: 110px;
    margin: 6px 5px;
    line-height: 30px;
    font-size: 14px;
    color: #1abc9c;
    background-color: #fff;
    border: 1px solid #ccc;
  }
  .el-form-item {
    text-align: right;
    width: 310px;
  }
  .component-listHeader .search-header .right button:hover {
    background-color: #1abc9c;
    color: #fff;
  }
  .component-listHeader .search-header .right .right-select-margin {
    margin-top: 8px;
    margin-right: 8px;
  }
  a{
    cursor: pointer;
  }
  .component_model_list{
    text-align: left;
  }
  .component_model_list>div:first-of-type{
    margin-bottom: 10px;
  }
  .component_model_list ul{
    padding-left: 70px;
    margin-top: -16px;
  }
  .component_model_list ul li{
    cursor: pointer;
  }
  .payBtn a{
    padding: 10px 20px;
  }
  .payBtn a:first-of-type{
    background: #1ABC9C;
    color: #fff;
    border-radius: 4px;
  }
  .payBtn a:last-of-type{
    border:1px solid #ccc;
    margin-left: 20px;
    border-radius: 4px;
  }
  .red{
    color: #1ABC9C;
  }
</style>
